﻿$(function () {
    var icon = "<i class='fa fa-times-circle'></i> ";
    var state = $('#State').val();
    var validator = $("#mainForm").validate({
        rules: {
           
            Amount: {
                required: true,
                number: true
            }
        },
        messages: {
            
            Amount: {
                required: icon + "请输入金额",
                number: icon + "必须输入数字"
            }
        },
        submitHandler: function (form) {
            //进行ajax传值
            $.ajax({
                url: "/Account/Brokerage/BrokerageSettleAccountsAsync",
                type: "post",
                dataType: "json",
                data: $('#mainForm').serialize(),
                success: function (data) {
                    //Info,Success,Warning,Error
                    var type = data.type;
                    if (type == 1) {
                        layer.msg(data.content, { icon: 6, time: 2000 },
                            function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            });

                    } else {
                        layer.msg(data.content, { icon: 5, time: 2000 });
                    }
                }
            });
        }
    });
});
